'use strict';

/* Controllers */
// signin controller
app.controller('StatementController', ['dbUtils','$rootScope', '$scope','$modal', '$state', 'dateFilter', 'BaseInfoService', function (dbUtils,$rootScope, $scope,$modal, $state, dateFilter, baseService) {


    var formGridOptions = {
        form: {
            settings: {
                cols: 3
            },
            fields: [
                {name: "balanceNo", label: "结算单号", type: "text", labelCols: "2"},
                /*{
                    name: "status",
                    label: "结算状态",
                    labelCols: "2",
                    type: "select",
                    items: [{
                        "key": "1",
                        "value": "已结算"
                    }, {
                        "key": "2",
                        "value": "未结算"
                    }]
                },*/
                {name: "_orderDateRange","label": "日期", "type": "dateRange","beginDateName":"startTime","endDateName":"endTime", "labelCols": "2"}
            ]
        },
        grid: {
            settings: {
                transCode: "/store/balanceList",
                autoLoad: true,
                pageSize:10,
                showCheckBox: false
            },
            header: [
                {name: "结算单号", field: "balanceNo",width:"10%"},
                {name: "结算时间", field: "time",compile:true,width:"20%"},
                /*{name: "当前状态", field: "status"},*/
                {name: "结算金额", field: "money"},
                {name: "开户行", field: "bank"},
                {name: "银行账号", field: "bankNo"}
            ],
            rowOperation: {show: false, width: "20%"}
        }
    }

    var formGridEvents = {
        grid: {
            fieldEvents: {
                "timeFormat":function(value){
                    var dt = new Date();
                    dt.setTime(value);
                    return dateFilter(dt,'yyyy-MM-dd HH:mm:ss')
                }
            },
            rowEvents: []
        }
    };

    $scope.dbFormGrid = {options: formGridOptions, events: formGridEvents};


}]);
